package com.xh.bussiness.tiku.service;



import com.xh.bussiness.tiku.bean.dto.PaperDto;
import com.xh.bussiness.tiku.bean.dto.PaperModuleDto;
import com.xh.bussiness.tiku.bean.request.*;
import com.xh.bussiness.tiku.model.Paper;
import com.xh.bussiness.tiku.model.PaperQuestion;
import com.xh.core.bean.XhPage;
import com.xh.core.service.IBaseService;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 试卷表 服务类
 * </p>
 *
 * @author daiwei
 * @since 2019-01-14
 */
public interface IPaperService extends IBaseService<Paper> {

    public List<PaperModuleDto> queryPaperModule();

    /**
     * 分页查询方法
     * @param page
     * @param bean
     * @return
     */
    public XhPage queryPaperPage(XhPage page, PaperQueryRequest bean);

    XhPage<PaperQueryRequest> queryExercise(XhPage<Paper> page,PaperQueryRequest bean);

    /**
     * 查询方法
     * @param bean
     * @return
     */
    public List queryPaper(PaperQueryRequest bean);

    /**
     * 试卷保存
     * @param bean
     * @return
     */
    public PaperDto addPaper(HttpServletRequest request,PaperSaveRequest bean);

    /**
     * 批量试卷保存
     * @param bean
     * @return
     */
    public void batchSavePaper(PaperBatchSaveRequest bean);


    /**
     * 获取试卷
     * @param id
     * @return
     */
    public PaperDto getPaper(String id);

    /**
     * 获取发布为作业的试卷中的试题(被删除的试题也要展示)
     * @author 赵文博
     * @date 2021/5/8 15:36
     * @param paperId
     * @return com.xh.bussiness.tiku.bean.dto.PaperDto
     **/
    PaperDto getPracticePaper(String paperId);

    /**
     * 获取简化试卷信息
     * @param id
     * @return
     */
    public PaperDto getSimplePaper(String id);
    /**
     * 审核试卷
     * @param id
     * @param status
     * @param rejectReason
     * @param rejectDesc
     * @return 
     */
	public boolean checkPaper(String id, Integer status, String rejectReason, String rejectDesc);

	public boolean updatePaper(Paper paper);
	/**
	 * 查询审核列表
	 * @param page 
	 * @param request
	 * @return
	 */
	public XhPage<Paper> queryCheckPaper(XhPage<Paper> page, PaperRequest request);

    PaperDto intellectPaper(PaperQuestionRequest bean) throws Exception;

    void deletePaper(String paperId);

    PaperQuestion addBlankRow(String paperId, String questionId, Integer blankRowCount);

    Integer queryPaperScore(String id);

    void addPaperQuestion(String businessType,String paperId, List<String> questionIds);

    String copyPaper(String paperId);

    XhPage<PaperQueryRequest> queryEntranceTest(XhPage<Paper> page, PaperQueryRequest bean);

//	/**
//	 * 智能组卷
//	 * @param bean
//	 * @return
//	 * @throws Exception 
//	 */
//	public PaperDto smartPaper(JYSmartPaperSaveRequest bean) throws Exception;

    /**
     * 修改试卷作答次数
     * @author 赵文博
     * @date 2021/8/27 18:21
     * @param id
     * @return void
     **/
    void updateAnswerCount(String id);

    List<String> selectPaperQuestion(String paperId);

    Integer selectScoreSum(List<String> ids);
}
